<script setup>
import { artGetChannelsService } from '@/api/article'
import { ref } from 'vue'

defineProps({
  modelValue: {
    type: [Number, String],
  },
  width: {
    type: String,
  },
})
const emit = defineEmits(['update:modelValue'])
const channelList = ref([])
async function getChannelList() {
  const res = await artGetChannelsService()
  channelList.value = res.data.data
}
getChannelList()
</script>

<template>
  <el-select :model-value="modelValue" style="width: 120px;" :style="{ width }" @update:model-value="emit('update:modelValue', $event)">
    <el-option v-for="channel in channelList" :key="channel.id" :label="channel.cate_name" :value="channel.id" />
  </el-select>
</template>
